<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../css/main.css">
    <link rel="stylesheet" href="../css/widget.css">
    <link rel="stylesheet" href="../css/operation.css">
    <link rel="stylesheet" href="../css/window.css">
    <link rel="stylesheet" href="../css/alarm.css">
    <link rel="stylesheet" href="../css/intelligence.css">
    <title>无锡市隧道群智慧管理平台</title>
    <style>
        #dify-chatbot-bubble-button {
            background-color: #1C64F2 !important;
        }
        #dify-chatbot-bubble-window {
            width: 640px !important;
            height: 800px !important;
        }
    </style>
</head>

<body>
    <div class="调色板" style="color: rgb(255, 176, 6)"></div>
    <div class="container-window-test" id="container-window-test"></div>

    <!-- --------------------------------- -->
    <div class="panel-evaluation">
        <div class="title">◈ 全维度考核评分</div>
        <div class="choose-system">
            <div class="choose-system-child">供配电</div>
            <div class="choose-system-child">排水</div>
            <div class="choose-system-child">消防</div>
            <div class="choose-system-child">通风</div>
            <div class="choose-system-child">照明</div>
            <div class="choose-system-child">土建</div>
        </div>
        <div class="btn-close-panel">×</div>
        <div class="final-score-panel">
            <img src="../img/main/formula.png" class="math-text">
            <div class="final-score">93.2</div>
            <div class="final-score-unit">分</div>
        </div>
        <div class="form-panel-head">
            <div class="form-panel-head-child">评分参数</div>
            <div class="form-panel-head-child">权重</div>
            <div class="form-panel-head-child">得分</div>
            <div class="form-panel-head-child">加权得分</div>
        </div>
        <div class="container-evaluation" id="container-evaluation">
        </div>
    </div>
    <!-- --------------------------------- -->
    <div class="panel-top">
        <div class="com-title">➣ 无锡市工业设备安装有限公司</div>
        <div class="main-title"> 无锡市隧道群智慧管理平台 </div>
        <img class="topBannerBg1" src="../img/main/topBannerBg.png" />
        <img class="topBannerBg2" src="../img/main/topBannerBg.png" />
        <div class="alarm-bell" id="alarm-bell">🔔</div>
        <div class="clock"></div>
        <div class="weather" id="weather">无锡</div>

        <div class="box-scroll-info box-scroll-info1">
            <div class="container-scroll-info container-scroll-info1" id="container-scroll-info1"></div>
        </div>
        <div class="box-scroll-info box-scroll-info2">
            <div class="container-scroll-info container-scroll-info2" id="container-scroll-info2"></div>
        </div>

    </div>
    <!-- 告警面板 -->
    <div class="box-alarm-list" id="box-alarm-list">
        <!-- <div class="title-box">❂ 当前报警</div> -->
        <div class="unconfirmed-alarm-list" id="unconfirmed-alarm-list"></div>
    </div>
    <div class="cover-bg cover-bg-left"></div>
    <div class="cover-bg cover-bg-right"></div>
    <div class="cover-bg cover-bg-top"></div>
    <div class="cover-bg cover-bg-bottom"></div>

    <div class="btns-top" id="btns-top">
        <div class="btn" id="btn-cldw"><img src="../img/main/cars.svg" />
            <p>车辆定位</p>
        </div>
        <div class="btn" id="btn-sdbz"><img src="../img/main/tunnel.svg" />
            <p>隧道名称</p>
        </div>
        <div class="btn" id="btn-show-tunnel-menu"><img src="../img/main/tunnelList.svg" />
            <p>隧道菜单</p>
        </div>
        <div class="btn" id="btn-toggle-gis"><img src="../img/main/gisIcon.svg" />
            <p>城市模型</p>
        </div>
        <div class="btn" id="btn-toggle-flood"><img src="../img/main/flood.svg" />
            <p>隧道防汛</p>
        </div>
    </div>
    <div class="cover-bg cover-bg-bottom"></div>

    <div class="btns-bottom" id="btns-bottom">
        <div class="toggle-btns-bottom" id="toggle-btns-bottom">〇</div>
        <div class="btns">
            <div class="btn btn-choosen" id="btn-zhgl">综合管理</div>
            <div class="btn" id="btn-ywgl">运维管理</div>
            <div class="btn" id="btn-szls">数字孪生</div>
            <div class="btn" id="btn-zhjc">智慧决策</div>
            <!-- <div class="btn">按钮</div>
            <div class="btn">按钮</div> -->
        </div>
    </div>
    <div class="side-tunnel-tunnel" id="side-tunnel-tunnel">
        <!-- <div class="tunnel-btn">
            <div class="tunnel-main-btn">界泾隧道</div>
            <div class="tunnel-sub-btns">
                <div class="tunnel-sub-btn">系统图监测</div>
                <div class="tunnel-sub-btn">三维可视化</div>
            </div>
        </div> -->

    </div>

    <iframe class="gis-iframe" id="gis-iframe" src=""></iframe>
    <!-- <iframe class="gis-iframe" id="gis-iframe" src="../GISWeb0109A/index.html"></iframe> -->
    <div class="map-container" id="map-container"></div>
    <div class="map-cover"></div>

    <div class="container-info-top" id="container-info-top"></div>

    <div class="panel panel-left">
        <div class="panel-system-count panels-bg" id="panel-system-count">
            <div class="title-panel">◈ 设备系统运行监测</div>
            <div class="container-system-count" id="container-system-count"></div>
        </div>
        <div class="panel-bubble-sensor panels-bg" id="panel-bubble-sensor">
            <div class="title-panel">◈ 物联智慧感知</div>
            <div class="btn-flip btn-flip-bubble-sensor" id="btn-flip-bubble-sensor"></div>
            <div class="container-bubble-sensor" id="container-bubble-sensor"></div>
        </div>
        <div class="panel-tunnel-alarm panels-bg" id="panel-tunnel-alarm">
            <div class="title-panel">◈ 累计缺陷上报占比</div>
            <div class="btn-flip btn-flip-tunnel-alarm" id="btn-flip-tunnel-alarm"></div>
            <div class="charts-container">
                <div class="chart-tunnel-alarm chart-tunnel-alarm1" id="chart-tunnel-alarm1"></div>
                <div class="chart-tunnel-alarm chart-tunnel-alarm2" id="chart-tunnel-alarm2"></div>
            </div>
        </div>
        <div class="panel-main-energy panels-bg" id="panel-main-energy">
            <div class="title-panel">◈ 近15周能耗统计</div>
            <div class="chart-main-energy" id="chart-main-energy"></div>
        </div>
        <div class="panel-iot-count panels-bg" id="panel-iot-count">
            <div class="title-panel">◈ 设备系统综合评价</div>
            <div class="anim-device-main" id="anim-device-main">
                <img src="../img/main/main-circlebg.png" class="part-anim1">
                <img src="../img/main/main-circle.png" class="part-anim2">
                <img src="../img/main/main-square.png" class="part-anim3">
            </div>
            <div class="container-iot-count" id="container-iot-count"></div>
        </div>

    </div>
    <div class="panel panel-right" id="panel-right">
        <div class="panel-operation-count panels-bg" id="panel-operation-count">
            <div class="container-operation-score" id="container-operation-score"></div>
            <div class="title-panel">◈ 近30天运维统计分析</div>
            <div class="container-operation-count" id="container-operation-count"></div>
            <div class="right-line"></div>
            <div class="title-chart">维修次数排行统计</div>
            <div class="chart-operation-count" id="chart-operation-count"></div>
        </div>
        <div class="panel-car-count panels-bg" id="panel-car-count">
            <div class="title-panel">◈ 本月车辆使用信息统计</div>
            <!-- <div class="container-car-count" id="container-car-count"></div> -->
            <div class="table-car">
                <div class="form-panel-head">
                    <div class="form-panel-head-child">车辆类型</div>
                    <div class="form-panel-head-child">车牌号</div>
                    <div class="form-panel-head-child">司机</div>
                    <div class="form-panel-head-child">本月里程</div>
                </div>
                <div class="container-table-car nicescrollDiv" id="container-table-car-main"></div>
            </div>
        </div>

        <div class="panel-person-count panels-bg" id="panel-person-count">
            <div class="title-panel">◈ 运维综合评价</div>
            <div class="container-person-count" id="container-person-count"></div>
        </div>
    </div>
    <div class="panel panel-bottom panels-bg" id="panel-bottom">
        <div class="container-timeline" id="container-timeline">
            <div class="long-line" id="long-line"></div>
        </div>
    </div>

    <div class="panel-operation" id="panel-operation">
        <!-- <div class="panel-operation" style="display: none;"> -->
        <div class="box-operation box-operation-side box-operation-statistics">
            <div class="title-panel">◈ 近30天运维统计</div>
            <div class="container-operation-count" id="container-operation-count-2"></div>
            <div class="right-line"></div>
            <div class="title-chart">维修次数排行</div>
            <div class="chart-operation-count" id="chart-operation-count2"></div>
            <!-- <div class="chart-operation-score chart-operation-score-1" id="chart-operation-score-1"></div> -->
            <!-- <div class="chart-operation-score chart-operation-score-2" id="chart-operation-score-2"></div> -->
        </div>
        <div class="box-operation box-operation-side box-person-statistics">
            <div class="title-panel">◈ 人员管理</div>
            <div class="container-person-count" id="container-person-count-2"></div>
            <div class="table-person">
                <div class="form-panel-head">
                    <div class="form-panel-head-child">人员</div>
                    <div class="form-panel-head-child">当前状态</div>
                    <div class="form-panel-head-child">岗位区域</div>
                    <div class="form-panel-head-child">本月工单数</div>
                </div>
                <div class="container-table-person nicescrollDiv" id="container-table-person"></div>
            </div>
        </div>
        <div class="box-operation box-operation-side box-car-statistics">
            <div class="title-panel">◈ 车辆管理</div>
            <div class="img-car"></div>
            <div class="count-car" id="count-car"></div>
            <div class="table-car">
                <div class="form-panel-head">
                    <div class="form-panel-head-child">车辆类型</div>
                    <div class="form-panel-head-child">车牌号</div>
                    <div class="form-panel-head-child">司机</div>
                    <div class="form-panel-head-child">本月里程</div>
                </div>
                <div class="container-table-car nicescrollDiv" id="container-table-car"></div>
            </div>
        </div>
        <div class="box-operation box-operation-side box-tool-statistics">
            <div class="title-panel">◈ 工器具管理</div>
            <div class="count-tool" id="count-tool"></div>
            <div class="table-tool">
                <div class="form-panel-head">
                    <div class="form-panel-head-child">名称</div>
                    <div class="form-panel-head-child">领用人</div>
                    <div class="form-panel-head-child">状态</div>
                    <div class="form-panel-head-child">数量</div>
                    <div class="form-panel-head-child">借用时间</div>
                </div>
                <div class="container-table-tool nicescrollDiv" id="container-table-tool"></div>
            </div>
        </div>
        <div class="box-operation box-operation-side box-spare-statistics">
            <div class="title-panel">◈ 备品备件管理</div>
            <div class="count-spare" id="count-spare"></div>
            <div class="table-spare">
                <div class="form-panel-head">
                    <div class="form-panel-head-child">名称</div>
                    <div class="form-panel-head-child">库存数量</div>
                    <div class="form-panel-head-child">库存状态</div>
                </div>
                <div class="container-table-spare nicescrollDiv" id="container-table-spare"></div>
            </div>
            <div class="chart-type-spare" id="chart-type-spare"></div>

        </div>

        <div class="btn-change-tasks box-operation-side" id="btn-change-tasks">
            <div class="btn btn-choosen" id="btn-cruise">✎ 巡检工单</div>
            <div class="btn" id="btn-tasks">✎ 任务工单</div>
            <div class="btn" id="btn-faults">✎ 缺陷工单</div>
            <div class="btn" id="btn-repairs">✎ 维修工单</div>
            <div class="btn" id="btn-repairs">✎ 专项保养</div>
        </div>
        <div class="btn-show-all-tasks" id="btn-show-all-tasks">▼</div>
        <!-- 今日巡检 -->
        <div class="box-operation box-operation-task" id="box-recent-cruise">
            <div class="title-box">✎ 巡检工单</div>
            <!-- <div class="container-ope-count" id="container-task-count"></div> -->
            <div class="form-panel-head">
                <div class="form-panel-head-child">工单号</div>
                <div class="form-panel-head-child">开始时间</div>
                <div class="form-panel-head-child" style="flex:2">岗位区域</div>
                <div class="form-panel-head-child" style="flex:0.5">班次</div>
                <div class="form-panel-head-child" style="flex:0.5">巡检人</div>
                <div class="form-panel-head-child" style="flex:0.5">工单状态</div>
            </div>
            <div class="container-work container-recent-cruise" id="container-recent-cruise"></div>
        </div>
        <div class="box-operation box-operation-task" id="box-recent-work-tasks">
            <div class="title-box">✎ 任务工单</div>
            <!-- <div class="container-ope-count" id="container-task-count"></div> -->
            <div class="form-panel-head">
                <div class="form-panel-head-child">工单号</div>
                <div class="form-panel-head-child">下发时间</div>
                <div class="form-panel-head-child" style="flex:2">任务内容</div>
                <div class="form-panel-head-child" style="flex:0.5">系统设备</div>
                <div class="form-panel-head-child" style="flex:0.5">建筑群</div>
                <div class="form-panel-head-child" style="flex:0.5">工单状态</div>
            </div>
            <div class="container-work container-recent-work-tasks" id="container-recent-work-tasks"></div>
        </div>

        <div class="box-operation box-operation-task" id="box-recent-faults">
            <div class="title-box">✎ 缺陷工单</div>
            <!-- <div class="container-ope-count" id="container-task-count"></div> -->
            <div class="form-panel-head">
                <div class="form-panel-head-child">工单号</div>
                <div class="form-panel-head-child">上报时间</div>
                <div class="form-panel-head-child" style="flex:2">缺陷内容</div>
                <div class="form-panel-head-child" style="flex:0.5">系统设备</div>
                <div class="form-panel-head-child" style="flex:0.5">建筑群</div>
                <div class="form-panel-head-child" style="flex:0.5">工单状态</div>
            </div>
            <div class="container-work container-recent-faults" id="container-recent-faults"></div>
        </div>
        <div class="box-operation box-operation-task" id="box-recent-repairs">
            <div class="title-box">✎ 缺陷维修工单</div>
            <!-- <div class="container-ope-count" id="container-task-count"></div> -->
            <div class="form-panel-head">
                <div class="form-panel-head-child">工单号</div>
                <div class="form-panel-head-child">维修时间</div>
                <div class="form-panel-head-child" style="flex:2">维修内容</div>
                <div class="form-panel-head-child" style="flex:0.5">系统设备</div>
                <div class="form-panel-head-child" style="flex:0.5">建筑群</div>
                <div class="form-panel-head-child" style="flex:0.5">工单状态</div>
            </div>
            <div class="container-work container-recent-repairs" id="container-recent-repairs"></div>
        </div>
    </div>
    <div class="panel-intelligence" id="panel-intelligence">
        <div class="panel-intelligence-child panel-intelligence-device" id="panel-intelligence-device">
            <div class="title-intelligence-panel">资产管理智慧决策分析</div>
            <div class="classification-device-btns classification-device-btns1">
                <div class="classification-btn btn-choosen" id="classification-btn-system">按系统分类</div>
                <!-- <div class="classification-btn">按隧道分类</div> -->
                <div class="classification-btn" id="classification-btn-type">按类型分类</div>
            </div>
            <div class="classification-device-btns classification-device-btns2">
                <div class="classification-device-btns-system" id="classification-device-btns-system">
                    <div class="classification-btn btn-choosen">全部</div>
                    <div class="classification-btn">供配电</div>
                    <div class="classification-btn">排水</div>
                    <div class="classification-btn">通风</div>
                    <div class="classification-btn">照明</div>
                    <div class="classification-btn">消防</div>
                    <div class="classification-btn">土建</div>
                </div>
                <div class="classification-device-btns-type" id="classification-device-btns-type">
                    <div class="classification-btn btn-choosen">全部</div>
                    <div class="classification-btn">水泵</div>
                    <div class="classification-btn">灯具</div>
                    <div class="classification-btn">配电柜</div>
                    <div class="classification-btn">消防泵</div>
                    <div class="classification-btn">射流风机</div>
                    <div class="classification-btn">路面</div>
                    <div class="classification-btn">装饰</div>
                    <div class="classification-btn">伸缩缝</div>
                </div>
            </div>
            <div class="panel-intelligence-device-count">
                <div class="title-box">◈ 近三年设备维修情况统计</div>
                <div class="container-intelligence-device-count" id="container-intelligence-device-count"></div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
                <img class="brightPoints" src="../img/main/brightPoints.png" />
            </div>
            <div class="panel-intelligence-device-chart">
                <div class="title-box">◈ 近三年设备维修次数排行</div>
                <div class="container-intelligence-device" id="container-intelligence-device"></div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>
            <div class="panel-intelligence-import-device">
                <div class="title-box">◈ 设备类型维修次数同比涨幅统计</div>
                <div class="box-intelligence-import-device1" id="box-intelligence-import-device1">
                    <div class="btn-flip btn-flip-intelligence-import-device1"
                        id="btn-flip-intelligence-import-device1"></div>
                    <div class="container-intelligence-import-device" id="container-intelligence-import-device"></div>
                </div>
                <div class="box-intelligence-import-device2" id="box-intelligence-import-device2">
                    <div class="btn-flip btn-flip-intelligence-import-device2"
                        id="btn-flip-intelligence-import-device2"></div>
                    <div class="chart-intelligence-import-device" id="chart-intelligence-import-device"></div>
                </div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>
            <div class="panel-intelligence-tunnel-chart">
                <div class="title-box">◈ 各隧道运行时间 & 近三年设备维修次数统计</div>
                <div class="chart-intelligence-tunnel" id="chart-intelligence-tunnel"></div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>

        </div>
        <div class="panel-intelligence-child panel-intelligence-person" id="panel-intelligence-person">
            <div class="title-intelligence-panel">运维管理智慧决策分析</div>
            <div class="container-total-working-hours" id="container-total-working-hours"></div>
            <div class="container-average-working-hours">
                <div class="title-box">◈ 累计平均工时占比</div>
                <div class="chart-average-working-hours" id="chart-average-working-hours"></div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>
            <div class="container-total-average-hours" id="container-total-average-hours">
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>
            <div class="box-intelligence-person">
                <div class="title-box">◈ 运维人员管理</div>
                <div class="btn-toggle-tasks">
                    <div class="btn btn-choosen" id="btn-intelligence-tasks-all">全部</div>
                    <div class="btn" id="btn-intelligence-patrols">巡检</div>
                    <div class="btn" id="btn-intelligence-tasks">任务</div>
                    <div class="btn" id="btn-intelligence-faults">缺陷</div>
                    <div class="btn" id="btn-intelligence-repairs">维修</div>
                    <div class="btn" id="btn-intelligence-maintenance">专项保养</div>
                </div>
                <div class="form-panel-head">
                    <div class="form-panel-head-child">人员</div>
                    <div class="form-panel-head-child">今年完成工单数</div>
                    <div class="form-panel-head-child">近30天完成工单数</div>
                    <div class="form-panel-head-child">今年工时数</div>
                    <div class="form-panel-head-child">近30天工时数</div>
                </div>
                <div class="container-table-intelligence-person nicescrollDiv" id="container-table-intelligence-person">
                </div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>

        </div>
        <div class="panel-intelligence-child panel-intelligence-energy" id="panel-intelligence-energy">
            <div class="title-intelligence-panel">能源管理智慧决策分析</div>
            <div class="container-intelligence-energy">
                <div class="title-container-chart"> 近15周能耗统计分析</div>
                <div class="chart-intelligence-energy" id="chart-intelligence-energy"></div>
            </div>
            <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
        </div>

        <div class="panel-intelligence-child panel-intelligence-mid" id="panel-intelligence-mid">
            <img class='kjbg' src="../img/main/kjbg.png" />
            <img class='brain-bg' src="../img/main/brain.png" />
            <img class='brain' id='brain' src="../img/main/brain2.png" />
            <div class="container-file-download" id="container-file-download"></div>
            <div class="container-ai-count" id="container-ai-count"></div>
            <div class="box-ai-real-warning" id="box-ai-real-warning">
                <div class="title-box">◈ 实时AI预警信息</div>
                <div class="form-panel-head">
                    <div class="form-panel-head-child">设备名称</div>
                    <div class="form-panel-head-child">预警参数</div>
                    <div class="form-panel-head-child" style="flex: 2;">预警信息</div>
                    <div class="form-panel-head-child" style="flex: 2;">时间</div>
                </div>
                <div class="container-ai-real-warning" id="container-ai-real-warning">
                </div>
            </div>
            <div class="panel-intelligence-bottom" id="panel-intelligence-bottom">
                <div class="panel-intelligence-faults-count">
                    <div class="title-box">◈ 累计缺陷上报占比</div>
                    <div class="chart-intelligence-faults-count" id="chart-intelligence-faults-count"></div>
                    <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
                </div>
                <div class="panel-intelligence-faults">
                    <div class="container-intelligence-faults" id="container-intelligence-faults"></div>
                    <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
                </div>
            </div>
            <div class="panel-intelligence-singal-ai" id="panel-intelligence-singal-ai">
                <div class="title-box">◈ AI预警设备参数实时数据监测</div>
                <div class="page-toggle">↩</div>
                <div class="chart-intelligence-singal-ai" id="chart-intelligence-singal-ai"></div>
                <img class="panel-kjbj" src="../img/main/panel-kjbj.jpg" />
            </div>

        </div>

    </div>

    <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=Z0nYTjcBrxRzWG5WupXv9VzhQ97wHEmj"></script>
    <script src="//mapopen.bj.bcebos.com/github/BMapGLLib/TrackAnimation/src/TrackAnimation.min.js"></script>

    <script src="//mapv.baidu.com/build/mapv.min.js"></script>
    <script src="https://code.bdstatic.com/npm/mapvgl@1.0.0-beta.159/dist/mapvgl.min.js"></script>

    <script src="../js/jquery-3.6.0.min.js"></script>
    <script src="../js/echarts.min.js"></script>
    <script src="../js/charts-function.js"></script>
    <script src="../js/scada.js"></script>
    <script src="../js/gis.js"></script>
    <script src="../js/data-main.js"></script>
    <script src="../js/widget-window.js"></script>
    <script src="../js/widget-main.js"></script>
    <script src="../js/widget-alarm.js"></script>
    <script src="../js/jquery.nicescroll.js"></script>
    <script src="../js/ui-function.js"></script>
    <!-- <script src="http://bilibili.github.io/flv.js/dist/flv.js"></script> -->
    <script src="../js/flv.js"></script>
    <script>

        function loadCarCamera() {
            // 检查浏览器是否支持 flv.js

        }
        const tunnelomsUrl = 'https://tunneloms.memanager.cn/'
        const tunnelUrl = 'https://tunnel.memanager.cn/'


        // <!全维度考核评分--------------------------------- -->
        $('.btn-close-panel').on('click', function () {
            $('.panel-evaluation').hide();
        });
        $('#panel-iot-count').on('click', function () {
            $('.panel-evaluation').show();
        });
        // $('#panel-bottom').on('click', function () {
        //     $('.panel-evaluation').show();
        // });
        // $('#panel-person-count').on('click', function () {
        //     $('.panel-evaluation').show();
        // });
        const evaluationData = [
            { item: "电压偏差", weight: 0.1, score: 73.3, score2: 7.3 },
            { item: "三相电压不平衡度", weight: 0.05, score: 85.2, score2: 4.3 },
            { item: "负载率", weight: 0.2, score: 100.0, score2: 20 },
            { item: "三相电流不平衡度", weight: 0.05, score: 90.5, score2: 4.5 },
            { item: "功率因数", weight: 0.1, score: 95.2, score2: 9.5 },
            { item: "跳闸次数", weight: 0.25, score: 100.0, score2: 25.0 },
            { item: "越限次数", weight: 0.25, score: 90.0, score2: 22.5 },
        ];


        evaluationData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            $('.container-evaluation').formcell(option);
        });

        //数据交互=========================================================================
        //天气
        $.get('https://restapi.amap.com/v3/weather/weatherInfo?key=4ab9a9b390233e17501eb68b0882f8e0&city=320200', function (res) {
            let province = res.lives[0].province + '省'
            let city = res.lives[0].city
            let weather = res.lives[0].weather
            let temperature = res.lives[0].temperature + '℃'
            $('#weather').text(province + city + ' ' + weather + ' ' + temperature)
        })

        //运行日志
        getRunRecord()
        setInterval(() => {
            getRunRecord()
        }, 2000)
        function getRunRecord() {
            $.get(tunnelomsUrl + 'run-logs/latest', function (res) {
                let tunnelName = res.data.tunnelName
                let deviceAbbr = res.data.deviceAbbr
                let logTime = res.data.logTime
                let content = res.data.content
                $('#container-scroll-info1').text(logTime + tunnelName + deviceAbbr + '：' + content)
            })
        }
        getAlarmRecord()
        setInterval(() => {
            getAlarmRecord()
        }, 2000)
        //报警日志
        function getAlarmRecord() {
            $.get('https://tunnel.memanager.cn/device-alarms', function (res) {
                let simpleCreateTime = res.data[0].simpleCreateTime
                let deviceName = res.data[0].deviceName
                let name = res.data[0].name
                $('#container-scroll-info2').text(simpleCreateTime + ' ' + deviceName + '：' + name)
            })
        }
        // $('#container-scroll-info1').text('青祁隧道北变电所 低压柜开关401A已合闸')
        // $('#container-scroll-info2').text('界泾隧道 前门红外对射报警器 侵入报警')
        let components = {};
        //智慧决策
        importantDeviceData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-intelligence-import-device').circleLabel(option);
        })
        aiWarningData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-ai-real-warning').formcell(option);
            components[option.name].pageToggle()
        })


        $.get(tunnelomsUrl + '/scada/stat-maintainer-all', function (res) {
            let data = []
            res.data.forEach(item => {
                if (item.name != '祁友安')
                    $('#container-table-intelligence-person').formcell(item);
            })

        });

        $('.btn-toggle-tasks').find('.btn').on('click', function () {
            $(this).addClass('btn-choosen')
            $(this).siblings().removeClass('btn-choosen')
        })
        $('#btn-intelligence-tasks-all').on('click', function () {
            $('#container-table-intelligence-person').empty()
            $.get(tunnelomsUrl + '/scada/stat-maintainer-all', function (res) {
                let data = []
                res.data.forEach(item => {
                    if (item.name != '祁友安')
                        $('#container-table-intelligence-person').formcell(item);
                })

            });
        })
        $('#btn-intelligence-patrols').on('click', function () {
            $('#container-table-intelligence-person').empty()
            $.get(tunnelomsUrl + '/scada/stat-maintainer-patrol', function (res) {
                let data = []
                res.data.forEach(item => {
                    if (item.name != '祁友安')
                        $('#container-table-intelligence-person').formcell(item);
                })

            });
        })
        $('#btn-intelligence-tasks').on('click', function () {
            $('#container-table-intelligence-person').empty()
            $.get(tunnelomsUrl + '/scada/stat-maintainer-worktask', function (res) {
                let data = []
                res.data.forEach(item => {
                    $('#container-table-intelligence-person').formcell(item);
                })

            });
        })
        $('#btn-intelligence-faults').on('click', function () {
            $('#container-table-intelligence-person').empty()
            $.get(tunnelomsUrl + '/scada/stat-maintainer-fault', function (res) {
                let data = []
                res.data.forEach(item => {
                    $('#container-table-intelligence-person').formcell(item);
                })

            });
        })
        $('#btn-intelligence-repairs').on('click', function () {
            $('#container-table-intelligence-person').empty()
            $.get(tunnelomsUrl + '/scada/stat-maintainer-repair', function (res) {
                let data = []
                res.data.forEach(item => {
                    $('#container-table-intelligence-person').formcell(item);
                })

            });
        })
        $('#btn-intelligence-maintenance').on('click', function () {
            $('#container-table-intelligence-person').empty()
            $.get(tunnelomsUrl + '/scada/stat-maintainer-maintain', function (res) {
                let data = []
                res.data.forEach(item => {
                    $('#container-table-intelligence-person').formcell(item);
                })

            });
        })


        spareIntelligenceData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-table-intelligence-spare').formcell(option);
        })
        intelligenceDeviceCount.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-intelligence-device-count').hexagonLabelValue(option);
        })

        fileData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-file-download').fileLabel(option);
        })
        aiCountData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-ai-count').labelValue(option);
        })

        //未确认告警列表
        var $unconfirmedAlarmList = $('.unconfirmed-alarm-list').alarmList({ title: '❂ 当前报警', state: 1, type: 0 });
        // $unconfirmedAlarmList.update(alarmData);
        ifContainerEmpty('unconfirmed-alarm-list')
        //判断是否为空列表
        function ifContainerEmpty(option) {
            const noDataTpl = `<div class="no-data-txt"> 暂无数据... </div>`
            if (option.length == 0) {
                $('#' + option.id).append($(noDataTpl))
            } else {
                $('#' + option.id).children('.no-data-txt').remove()
            }
        }
        InfoTop.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            $('#container-info-top').labelValueUnit(option);
        })
        //设备系统运行监测
        let sumDeviceTotal = 0
        let sumDeviceFault = 0
        $.get(tunnelomsUrl + '/scada/device-count-by-system', function (res) {
            res.data.forEach(item => {
                if (item.system != '其它系统') {
                    let option = {
                        label1: '总数量', label2: '完好率', label3: '维护中',
                        title: '▧ ' + item.system,
                        value1: item.total,
                        value2: (((item.total - item.fault) / item.total) * 100).toFixed(0) + '%',
                        value3: item.fault,
                    }
                    //获取组件后放入组件注册表
                    components[option.name] = $('#container-system-count').systemCountWidget(option);
                    sumDeviceTotal += item.total
                    sumDeviceFault += item.fault
                }

            })
            deviceHealthData.unshift({ label: '设备完好率', value: (((sumDeviceTotal - sumDeviceFault) / sumDeviceTotal) * 100).toFixed(0) + '%' }, { label: '设备故障率', value: ((sumDeviceFault / sumDeviceTotal) * 100).toFixed(0) + '%' },)
            deviceHealthData.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                components[option.name] = $('#container-iot-count').labelValue(option);
            })
        });

        sensorCountData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-bubble-sensor').bubbleWidget(option);
        })
        tunnelData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            components[option.name] = $('#container-timeline').timeLine(option);
        })

        // carData.forEach(item => {
        //     var option = $.extend({}, item);
        //     //获取组件后放入组件注册表
        //     components[option.name] = $('#container-car-count').carCountWidget(option);
        // })


        //人员信息统计管理
        let sumTaskValue = 0
        $.get(tunnelomsUrl + '/scada/user-workload?limit=60', function (res) {
            // 对res.data进行排序，使sign_state为true的项排在前面
            // res.data.sort((a, b) => {
            //     // 如果a.sign_state为true而b.sign_state为false，则a排在b前面
            //     if (a.sign_state && !b.sign_state) return -1;
            //     // 如果a.sign_state为false而b.sign_state为true，则a排在b后面
            //     if (!a.sign_state && b.sign_state) return 1;
            //     // 如果两者sign_state相同，则保持原有顺序
            //     return 0;
            // });

            res.data.forEach(item => {
                if (item.sign_state) {
                    let state
                    let taskValue
                    let area
                    item.sign_state ? state = { value: '在岗', 'color': 'aqua' } : state = { value: '未在岗', 'color': 'gray' }
                    item.value ? taskValue = item.value : taskValue = '0'
                    item.area ? area = item.area : area = ''
                    let option = {
                        name: item.name,
                        state: state,
                        area: area,
                        value: taskValue,
                    }
                    $('#container-table-person').formcell(option);
                }

                sumTaskValue += item.value;
            })
        });
        refreshCarInfoPanel()
        setInterval(() => {
            refreshCarInfoPanel()
        }, 60000)
        function refreshCarInfoPanel() {
            let data = []
            let carCount = 0
            let carSum = 0
            $('#container-table-car').empty()
            $('#container-table-car-main').empty()
            $('#count-car').empty()
            $.get(tunnelomsUrl + '/scada/vehicles', function (res) {
                // $.get('../mock/vehicles.json', function (res) {
                res.data.forEach(item => {
                    let driver
                    if (item.driver_name) {
                        driver = { value: item.driver_name, color: 'aqua' }
                        carCount++
                    } else {
                        driver = '待命'
                    }
                    data.push({
                        type: item.type,
                        name: item.name,
                        driver: driver,
                        milage: item.milage
                    })
                })
                let runData = data.filter(item => item.driver != "待命");
                let stopData = data.filter(item => item.driver == "待命");
                // 合并数组
                let newData = runData.concat(stopData);
                newData.forEach(item => {
                    var option = $.extend({}, item);
                    //获取组件后放入组件注册表
                    $('#container-table-car').formcell(option);
                    let $item = $('#container-table-car-main').formcell(option);
                    if (item.name != '其他') {
                        carSum++
                    }
                    if (item.name == '苏B·959V2') {
                        
                        
                        let listData = [{
                            label: '车辆类型',
                            value: item.type
                        }, {
                            label: '车牌号',
                            value: item.name
                        }, {
                            label: '随行司机',
                            value: item.driver.value
                        }]
                        
                        $item.detailVideo(listData,
                        // 'http://218.90.148.182:28080/sms/34020000002020000001/flv/hls/41010500001110000003_34020000001310000002.flv',
                        // 'http://218.90.148.182:28080/sms/34020000002020000001/flv/hls/41010500001110000003_34020000001310000001.flv'

                        'https://mps.memanager.cn/gb28181/sms/34020000002020000001/flv/hls/34020000001320000001_34020000001320000001.flv',
                        'https://mps.memanager.cn/gb28181/sms/34020000002020000001/flv/hls/34020000001320000001_34020000001320000001.flv',
                        );
                    }

                })
                $('#count-car').lightLabelValue({ label: '当前运行车辆', value: carCount, unit: '/' + carSum + '辆' });

            });

        }

        $.get(tunnelomsUrl + '/scada/tools-use', function (res) {
            let data = [
                { label: '今日借出', value: '0', unit: '件' },
                { label: '今日归还', value: '0', unit: '件' },
                { label: '当前借出', value: '0', unit: '件' },
                { label: '库存总数', value: '0', unit: '件' },
            ]
            res.data.forEach(item => {
                data[0].value = Math.abs(parseInt(item.useQuantity, 10))
                data[1].value = item.returnQuantity
                data[2].value = Math.abs(parseInt(item.beUsed, 10))
                data[3].value = item.quantity
            })
            data.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                $('#count-tool').lightLabelValue(option);
            })

        });

        $.get(tunnelomsUrl + '/scada/tools', function (res) {
            let data = []
            res.data.forEach(item => {
                data.push({
                    name: item.name,
                    user: item.use_by,
                    state: { value: '未归还', color: 'orange' },
                    count: Math.abs(parseInt(item.quantity, 10)) + '件',
                    time: item.use_time
                })
            })
            console.log(data)
            data.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                $('#container-table-tool').formcell(option);
            })
        });
        $.get(tunnelomsUrl + '/scada/spareparts-top', function (res) {
            let data = [
                { label: '本月出库数量', value: '0', unit: '件' },
                { label: '本月入库数量', value: '0', unit: '件' },
                { label: '库存总数', value: '0', unit: '件' },
            ]
            res.data.forEach(item => {
                data[0].value = Math.abs(parseInt(item.ck_quantity, 10))
                data[1].value = item.rk_quantity
                data[2].value = item.quantity

            })
            data.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                components[option.name] = $('#count-spare').lightLabelValue(option);
            })

        });

        $.get(tunnelomsUrl + '/scada/spareparts', function (res) {
            let data = []
            res.data.forEach(item => {
                let color
                item.state == '高库存' ? color = 'orange' : color = 'rgb(255, 43, 6)'
                data.push({
                    name: item.name,
                    user: { value: item.quantity, color: color },
                    state: { value: item.state, color: color },
                })
            })
            console.log(data)
            data.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                $('#container-table-spare').formcell(option);
            })
        });
        $.get(tunnelomsUrl + '/scada/stat-work-order', function (res) {
            let data = []
            let dataPie = []
            res.data.forEach(item => {
                let type
                let typePie
                switch (item.name) {
                    case 'fault':
                        type = '缺陷上报平均响应时间'
                        typePie = '缺陷上报'
                        break;
                    case 'maintain':
                        type = '专项维保平均工时'
                        typePie = '专项维保'
                        break;
                    case 'patrol':
                        type = '巡检工单平均工时'
                        typePie = '巡检工单'
                        break;
                    case 'repair':
                        type = '缺陷维修平均工时'
                        typePie = '缺陷维修'
                        break;
                    case 'work-task':
                        type = '任务工单平均工时'
                        typePie = '任务工单'
                        break;
                    default:
                        type = 'others'
                        break;
                }
                if (item.name != 'fault' && type != 'others') {
                    data.push({ label1: type, value1: (item.value2 / item.value1).toFixed(1) + 'h', label2: '工单数', value2: item.value1, label3: '总工时', value3: item.value2 + 'h' })
                    dataPie.push({ value: (item.value2 / item.value1).toFixed(1), name: typePie })
                }
            })
            data.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                components[option.name] = $('#container-total-average-hours').tripleLightLabelValue(option);
            })
            let myChart = echarts.init(document.getElementById('chart-average-working-hours'));
            myChart.setOption(createPieOption({ data: dataPie, line: 1 }));

        });

        //能耗
        $.get(tunnelomsUrl + '/scada/weekly-electric-amount', function (res) {
            let dataX = ['2025年\n第6周', '2025年\n第7周', '2025年\n第8周', '2025年\n第9周', '2025年\n第10周', '2025年\n第11周', '2025年\n第12周', '2025年\n第13周', '2025年\n第14周', '2025年\n第15周', '2025年\n第16周', '2025年\n第17周', '2025年\n第18周', '2025年\n第19周', '2025年\n第20周']
            let data1 = [16.9, 16.6, 15.0, 17.8, 14.5, 14.5, 16.7, 16.7, 13.8, 13.5, 13.3, 12.8, 13.6, 14.1, 14.5]
            let data2 = [187, 190, 160, 154, 121, 100, 100, 77, 93, 161, 127, 178, 215, 187, 188]
            let myChart1 = echarts.init(document.getElementById('chart-main-energy'));
            let myChart2 = echarts.init(document.getElementById('chart-intelligence-energy'));
            res.data.reverse().forEach(item => {
                // dataX.push(item.year + '年\n第' + item.week + '周')
                // data1.push(item.amount)
            });
            myChart1.setOption(createDoubleLineOption({ dataX: dataX, data1: data1, data2: data2, labelY1: '(万元)', labelY2: '(t)', label1: '电费', label2: '用水量' }));
            myChart2.setOption(createDoubleLineOption({ dataX: dataX, data1: data1, data2: data2, labelY1: '(万元)', labelY2: '(t)', label1: '电费', label2: '用水量' }));

        });
        $.get(tunnelomsUrl + '/scada/year-repair-rank', function (res) {
            let dataY = []
            let data = []
            let myChart1 = echarts.init(document.getElementById('chart-operation-count'));
            let myChart2 = echarts.init(document.getElementById('chart-operation-count2'));
            res.data.reverse().forEach(item => {
                if (item.name != null) {
                    dataY.push(item.name)
                    data.push(item.value)
                }
            });
            myChart1.setOption(createRankBarOption({ dataY: dataY, data: data, labelX: '/次', labelY: '' }))
            myChart2.setOption(createRankBarOption({ dataY: dataY, data: data, labelX: '/次', labelY: '' }))


        });


        {
            let myChart = echarts.init(document.getElementById('chart-intelligence-singal-ai'));
            let dataX = ['10:01:02', '10:01:02', '10:01:03', '10:01:04', '10:01:05', '10:01:06', '10:01:07', '10:01:08', '10:01:09', '10:01:10', '10:01:11', '10:01:12', '10:01:13', '10:01:14', '10:01:15'];
            let data1 = [10.2, 11.5, 10.3, 15.2, 13.2, 10.2, 9.8, 9.5, 10.5, 5.0, 0, 0, 0, 0, 0];
            myChart.setOption(createDoubleLineOption({ dataX: dataX, data1: data1, labelY1: '(A)', label1: 'JJ_401A——Ia' }));

        }

        {
            let myChart1 = echarts.init(document.getElementById('container-intelligence-device'));
            let dataY = ['SZM-7', 'SZM-8', 'NSB-1', 'TF-FR41', 'NZM-22', 'NZM-10', 'NZM-9', 'SZM-9'];
            let data = [5, 6, 6, 12, 16, 16, 16, 25];
            myChart1.setOption(createRankBarOption({ dataY: dataY, data: data, labelX: '', labelY: '' }));

        }
        {
            let myChart = echarts.init(document.getElementById('chart-intelligence-import-device'));
            let dataX = ['灯具', '水泵', '配电柜', '伸缩缝', '射流风机', '装饰', '路面', '消防泵'];
            let data1 = [100, 50, 75, 100, 100, 50, 60, 100];
            let data2 = [122, 59, 87, 116, 122, 52, 61, 101];
            myChart.setOption(createDoubleBarOptionType2({ dataX: dataX, data1: data1, data2: data2, labelY: '(次)', label1: '去年', label2: '今年' }));

        }
        {
            let myChart = echarts.init(document.getElementById('chart-intelligence-tunnel'));
            let dataX = ['太湖大道隧道', '金城隧道', '蠡湖隧道', '青祁隧道', '惠山隧道', '高浪路隧道', '界泾隧道'];
            let data1 = [12, 14, 15, 14, 14, 1, 1];
            let data2 = [60, 90, 170, 30, 90, 2, 2];
            myChart.setOption(createDoubleBarOption({ dataX: dataX, data1: data1, data2: data2, labelY1: '(年)', labelY2: '(次)', label1: '运行时间', label2: '维修次数' }));

        }


        $.get(tunnelomsUrl + '/scada/fault-source', function (res) {
            let data = []
            let intelligencFaults = [
                { label: '物联上报', value: '0次', icoUrl: '../img/main/faults.png' },
                { label: 'AI上报', value: '0次', icoUrl: '../img/main/faults.png' },
                { label: '人工上报', value: '0次', icoUrl: '../img/main/faults.png' },
                { label: '业主上报', value: '0次', icoUrl: '../img/main/faults.png' },
            ]
            let myChart1 = echarts.init(document.getElementById('chart-tunnel-alarm1'));
            let myChart2 = echarts.init(document.getElementById('chart-intelligence-faults-count'));
            res.data.forEach(item => {
                let type
                switch (item.source) {
                    case 1:
                        type = '人工上报'
                        intelligencFaults[2].value = item.value + '次'
                        break;
                    case 2:
                        type = '物联上报'
                        intelligencFaults[0].value = item.value + '次'
                        break;
                    default:
                        break;
                }
                data.push({ value: item.value, name: type })
            });
            myChart1.setOption(createPieOption({ data: data, line: 1 }));
            myChart2.setOption(createPieOption({ data: data, line: 1 }));
            intelligencFaults.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                $('#container-intelligence-faults').labelIconValue(option);
            })
        });

        $.get(tunnelomsUrl + '/scada/fault-state', function (res) {
            let data = []
            let myChart = echarts.init(document.getElementById('chart-tunnel-alarm2'));
            res.data.forEach(item => {
                let type
                switch (item.state) {
                    case 1:
                        type = '待处置'
                        break;
                    case 2:
                        type = '待维修'
                        break;
                    case 3:
                        type = '维修中'
                        break;
                    case 4:
                        type = '待审核'
                        break;
                    case 5:
                        type = '已归档'
                        break;
                    case 6:
                        type = '已撤销'
                        break;

                    default:
                        break;
                }
                data.push({ value: item.value, name: type })
            });
            myChart.setOption(createPieOption({ data: data, line: 1 }));
        });
        $.get(tunnelomsUrl + '/scada/spareparts-right', function (res) {
            let data = []
            let myChart = echarts.init(document.getElementById('chart-type-spare'));
            res.data.forEach(item => {
                let type
                switch (item.type) {
                    case 1:
                        type = '电气'
                        break;
                    case 2:
                        type = '管道'
                        break;
                    case 3:
                        type = '消防'
                        break;
                    case 4:
                        type = '五金'
                        break;
                    case 5:
                        type = '其他'
                        break;
                    default:
                        break;
                }
                data.push({ value: item.type_count, name: type })
            });
            myChart.setOption(createPieOption({ data: data, line: 1 }));
        });

        refreshTaskData()
        setInterval(() => {
            refreshTaskData()
        }, 60000)
        function refreshTaskData() {
            $('#container-recent-cruise').empty()
            $('#container-recent-faults').empty()
            $('#container-recent-defect').empty()
            $('#container-recent-tasks').empty()
            //巡检
            $.get(tunnelomsUrl + '/scada/today-patrols', function (res) {
                // $.get('../mock/recent-patrols.json', function (res) {
                res.data.forEach(item => {
                    var location;
                    var content;
                    if (item.routeList && item.routeList[0]) {
                        location = item.routeList[0].title;
                        content = item.content
                    } else {
                        location = '——';
                        content = '——';
                    }
                    var $item = $('#container-recent-cruise').formcell({
                        no: item.no,
                        footLeft: item.startTime,
                        title: location,
                        team: '',
                        footRight: item.patrolByName,
                        stateText: item.stateText
                    });
                    var imgs = [];
                    if (item.imgs) {
                        item.imgs.split(',').forEach(it => {
                            imgs.push({
                                url: tunnelomsUrl + '/img/' + it,
                                scan: 0
                            });
                        })
                    }
                    var data = [{
                        label: '巡检人员',
                        value: item.patrolByName
                    }, {
                        label: '随行车辆',
                        value: item.vehicle
                    }, {
                        label: '随行司机',
                        value: item.driver
                    }, {
                        label: '巡检内容',
                        value: item.content
                    }, {
                        label: '开始时间',
                        value: item.startTime
                    }]
                    //巡检路线
                    if (item.routeList) {
                        item.routeList.forEach((it, index) => {
                            data.push({
                                label: '巡检位置' + (index + 1),
                                value: it.title
                            });
                        })
                    }
                    $item.detail(data, imgs);
                });
                //判断是否为空列表
                ifContainerEmpty({ id: 'container-recent-cruise', length: res.data.length })
            });


            //缺陷
            $.get(tunnelomsUrl + '/scada/recent-faults?count=10', function (res) {
                res.data.forEach(item => {
                    var $item = $('#container-recent-faults').formcell({
                        no: item.no,
                        reportTime: item.reportTime,
                        content: item.content,
                        deviceName: '-',
                        team: item.deviceName,
                        stateText: item.stateText
                    });
                    var imgs = [];
                    if (item.faultImgs) {
                        item.faultImgs.split(',').forEach(it => {
                            imgs.push({
                                url: tunnelomsUrl + '/img/' + it,
                                scan: 0
                            });
                        })
                    }
                    $item.detail([{
                        label: '设备名称',
                        value: item.deviceName
                    }, {
                        label: '设备位置',
                        value: item.deviceLocation
                    }, {
                        label: '缺陷描述',
                        value: item.content
                    }, {
                        label: '缺陷等级',
                        value: item.levelText
                    }, {
                        label: '上报人员',
                        value: item.reportByName
                    }, {
                        label: '上报时间',
                        value: item.reportTime
                    }, {
                        label: '处置方式',
                        value: item.repairHandleText
                    }], imgs);
                })
                //判断是否为空列表
                ifContainerEmpty({ id: 'container-today-defect', length: res.data.length })
            });

            //工单
            $.get(tunnelomsUrl + '/scada/recent-work-tasks?count=10', function (res) {
                res.data.forEach(item => {
                    var $item = $('#container-recent-work-tasks').formcell({
                        no: item.no,
                        reportTime: item.createTime,
                        content: item.content,
                        deviceName: '-',
                        locations: item.locations,
                        stateText: item.stateText
                    });
                    var imgs = [];
                    if (item.faultImgs) {
                        item.faultImgs.split(',').forEach(it => {
                            imgs.push({
                                url: tunnelomsUrl + '/img/' + it,
                                scan: 0
                            });
                        })
                    }
                    $item.detail([{
                        label: '目标设施',
                        value: item.devices
                    }, {
                        label: '设施位置',
                        value: item.locations
                    }, {
                        label: '任务描述',
                        value: item.content
                    }, {
                        label: '下派人员',
                        value: item.createByName
                    }, {
                        label: '工单时间',
                        value: item.createTime
                    }, {
                        label: '工单状态',
                        value: item.stateText
                    }], imgs);
                })
                //判断是否为空列表
                ifContainerEmpty({ id: 'container-today-defect', length: res.data.length })
            });

            //维修
            $.get(tunnelomsUrl + '/scada/recent-repairs?count=10', function (res) {
                res.data.forEach(item => {
                    var $item = $('#container-recent-repairs').formcell({
                        no: item.no,
                        reportTime: item.createTime,
                        content: item.content,
                        deviceName: '-',
                        locations: item.deviceLocation,
                        stateText: item.stateText
                    });
                    var imgs = [];
                    if (item.faultImgs) {
                        item.faultImgs.split(',').forEach(it => {
                            imgs.push({
                                url: tunnelomsUrl + '/img/' + it,
                                scan: 0
                            });
                        })
                    }
                    $item.detail([{
                        label: '设备名称',
                        value: item.deviceName
                    }, {
                        label: '设备位置',
                        value: item.deviceLocation
                    }, {
                        label: '维修内容',
                        value: item.content
                    }, {
                        label: '负责人员',
                        value: item.directorName
                    }, {
                        label: '完成情况',
                        value: item.completion
                    }, {
                        label: '创建时间',
                        value: item.createTime
                    }, {
                        label: '完成时间',
                        value: item.completeTime
                    }], imgs);
                })
                //判断是否为空列表
                ifContainerEmpty({ id: 'container-today-defect', length: res.data.length })
            });
        }


        //主页左上角工时统计
        let operationScoreData = []
        let monthlyWorktime = 0
        let monthlyTaskCount = 0
        $.ajax({
            url: tunnelomsUrl + '/scada/year-worktime',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                console.log(res);
                res.data.forEach(item => {
                    operationScoreData.push({ label: '今年总工时', value: item.worktime + 'h' })
                });
            }
        });
        $.ajax({
            url: tunnelomsUrl + '/scada/month-worktime',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    operationScoreData.push({ label: '近30天总工时', value: item.worktime + 'h' })
                    monthlyWorktime += item.worktime
                });
            }
        });

        operationScoreData.forEach(item => {
            var option = $.extend({}, item);
            //获取组件后放入组件注册表
            $('#container-operation-score').labelValue(option);
            $('#container-total-working-hours').labelValue(option);
        })

        //人员评分
        let personScoreData = [
            { label: '运维质量综合评分', value: '**分', color: 'rgb(0, 255, 0)' },
        ]
        $.ajax({
            url: tunnelomsUrl + '/scada/daily-work-orders?days=30',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    monthlyTaskCount += item.value
                });
                personScoreData.unshift({ label: '近30天工单均时', value: (monthlyWorktime / monthlyTaskCount).toFixed(1) + 'h' })
                $('#container-total-working-hours').labelValue({ label: '近30天工单数', value: monthlyTaskCount + '单' });

            }
        });
        $.get(tunnelomsUrl + '/scada/on-duty-users-count', function (res) {
            personScoreData.unshift({ label: '当前在岗运维人员', value: res.data + '/135人', break: 1 })
            personScoreData.forEach(item => {
                var option = $.extend({}, item);
                //获取组件后放入组件注册表
                $('#container-person-count').iconLabelValue(option);
                $('#container-person-count-2').iconLabelValue(option);
            })
        });



        //近30天运维统计分析
        let count_patrols = 0;//巡检
        let count_work = 0;//工单
        let count_maintain = 0;//专项维保
        let count_faults = 0;//缺陷上报
        let count_repairs = 0;//缺陷维修
        let comWorks = []
        $.ajax({
            url: tunnelomsUrl + '/scada/daily-patrols?days=30',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    count_patrols += item.value
                });
                comWorks.push({ label: '日常巡检', value: count_patrols + '次', icoUrl: '../img/main/mile-icon.png' })
            }
        });
        $.ajax({
            url: tunnelomsUrl + '/scada/daily-faults?days=30',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    count_faults += item.value
                });
                comWorks.push({ label: '缺陷上报', value: count_faults + '次', icoUrl: '../img/main/faults.png' })
            }
        });
        $.ajax({
            url: tunnelomsUrl + '/scada/daily-repairs?days=30',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    count_repairs += item.value
                });
                comWorks.push({ label: '缺陷维修', value: count_repairs + '次', icoUrl: '../img/main/tools.png' })
            }
        });
        $.ajax({
            url: tunnelomsUrl + '/scada/daily-work-tasks?days=30',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    count_work += item.value
                });
                comWorks.push({ label: '任务工单', value: count_work + '次', icoUrl: '../img/main/paperClip.png' })
            }
        });
        $.ajax({
            url: tunnelomsUrl + '/scada/daily-maintain-tasks?days=30',
            type: 'GET',
            async: false, // 设置为同步请求
            success: function (res) {
                res.data.forEach(item => {
                    count_maintain += item.value
                });
                comWorks.push({ label: '专项保养', value: count_maintain + '次', icoUrl: '../img/main/paper.png' })
            }
        });
        comWorks.forEach(item => {
            var option = $.extend({}, item);
            console.log('comWorks', option);
            //获取组件后放入组件注册表
            $('#container-operation-count').labelIconValue(option);
            $('#container-operation-count-2').labelIconValue(option);
        })


        // function ifDataNull(value) {
        //     if (value == null) {
        //         value = 0
        //     }
        //     return value
        // }

        // $('#box-operation-statistics').append($('#panel-operation-count').clone(true));
    </script>
<!--
    <script async defer
        src="https://gpt.memanager.cn/api/application/embed?protocol=https&host=gpt.memanager.cn&token=82b73c36029f0774">
        </script>
-->

    <script> window.difyChatbotConfig = {
        token: 'KIJIF483FDpto4AF',
        baseUrl: 'https://gpt.memanager.cn',
        systemVariables: {}
    }
    </script>
    <script src="https://gpt.memanager.cn/embed.min.js" id="KIJIF483FDpto4AF" defer></script>

</body>

</html>